﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ElevatorAPI
{
    public class Building
    {
        private readonly List<Floor> _floors;
        public List<Floor> Floors { get { return _floors; } }

        private readonly Elevator _elevator;
        public Elevator Elevator { get { return _elevator; } }

        public Building()
        {

        }

        public Building(List<Floor> FloorsInBuilding, Elevator Elevator):this()
        {
            _floors = FloorsInBuilding;
            _elevator = Elevator;

           // if (Floors == null || Elevator.DefaultElevatorFloor == null || Floors.IndexOf(Elevator.DefaultElevatorFloor) < 0)
           //     throw new ApplicationException("Elevator Starting Floor Must Be In The List Of Floors In The Building");

            //sort floors to be in correct sequence
            //_floors = Floors.OrderBy(f => f.Number).ToList();

            //set to and bottom floors to know their position so they can not press incorrect button to call elevator.
            //_floors[0].IsBottomMostFloor = true;
            //_floors[0].IsTopMostFloor = false;
            //_floors[_floors.Count - 1].IsTopMostFloor = true;
            //_floors[_floors.Count - 1].IsBottomMostFloor = false;

            //Elevator.ResetElevator();
        }
    }
}
